

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=&#34;auto&#34;>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.ico">
  <link rel="icon" href="/img/favicon.ico">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="description" content="叶尘的技术升级小木屋">
  <meta name="author" content="叶尘">
  <meta name="keywords" content="">
  
  <title>JavaWeb - 叶尘的技术升级小木屋</title>

  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4.0.0/github-markdown.min.css" />
  <link  rel="stylesheet" href="/lib/hint/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@10.7.2/styles/github-gist.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
  



<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_kmeydafke9r.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->

  
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/bynotes/texiao/source/css/shubiao.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/bynotes/texiao/source/css/gundongtiao.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/bynotes/texiao/source/css/daziyanse.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/bynotes/texiao/source/css/toubudaziji.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">



  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"www.yechen-blog.cn","root":"/","version":"1.8.11","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"copy_btn":true,"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null}},"search_path":"/local-search.xml"};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 5.4.0"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/">&nbsp;<strong>YECHEN</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-qrcode"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/playlist/">
                <i class="iconfont icon-music"></i>
                音乐
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" target="_self" role="button"
                 data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <i class="iconfont icon-books"></i>
                链接
              </a>
              <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                
                  
                  
                  
                  <a class="dropdown-item" target="_blank" rel="noopener" href="https://hexo.fluid-dev.com/">
                    
                    主题博客
                  </a>
                
                  
                  
                  
                  <a class="dropdown-item" target="_blank" rel="noopener" href="https://hexo.fluid-dev.com/docs/guide/">
                    
                    配置指南
                  </a>
                
                  
                  
                  
                  <a class="dropdown-item" target="_blank" rel="noopener" href="https://hexo.fluid-dev.com/docs/icon/">
                    
                    图标用法
                  </a>
                
                  
                  
                  
                  <a class="dropdown-item" target="_blank" rel="noopener" href="https://www.bilibili.com">
                    
                    哔哩哔哩
                  </a>
                
              </div>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" data-toggle="modal" data-target="#modalSearch">&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;</a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner" id="banner" parallax=true
         style="background: url('/img/banner.jpg') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="JavaWeb">
              
            </span>

            
              <div class="mt-3">
  
    <span class="post-meta mr-2">
      <i class="iconfont icon-author" aria-hidden="true"></i>
      叶尘
    </span>
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2021-09-13 20:50" pubdate>
        星期一, 九月 13日 2021, 8:50 晚上
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      4.1k 字
    </span>
  

  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      55
       分钟
    </span>
  

  
  
    
      <!-- LeanCloud 统计文章PV -->
      <span id="leancloud-page-views-container" class="post-meta" style="display: none">
        <i class="iconfont icon-eye" aria-hidden="true"></i>
        <span id="leancloud-page-views"></span> 次
      </span>
    
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">JavaWeb</h1>
            
            <div class="markdown-body">
              <h2 id="1、基本概念"><a href="#1、基本概念" class="headerlink" title="1、基本概念"></a>1、基本概念</h2><h3 id="1-1-前言"><a href="#1-1-前言" class="headerlink" title="1.1 前言"></a>1.1 前言</h3><p>web开发：</p>
<ul>
<li>web，网页的意思， <a target="_blank" rel="noopener" href="http://www.baidu.com/">www.baidu.com</a></li>
<li>静态 web：<ul>
<li>html , css</li>
<li>提供给所有人看到数据始终不会发生变化！</li>
</ul>
</li>
<li>动态 web：<ul>
<li>淘宝，京东，几乎所有网站都是；</li>
<li>提供给所有人看到的数据始终会发生变化，每个人在不同事件、不同地点看到的信息时不同的！</li>
<li>技术栈：Servlet \ JSP \ ASP \ PHP</li>
</ul>
</li>
</ul>
<p>==在 Java 中，动态 Web 资源开发的技术统称为 JavaWeb== </p>
<h3 id="1-2-web-应用程序"><a href="#1-2-web-应用程序" class="headerlink" title="1.2 web 应用程序"></a>1.2 web 应用程序</h3><p><strong>web 应用程序：可以提供浏览器访问的程序：</strong></p>
<ul>
<li>a.html、b.html、… 多个 web 资源，这些 web 资源可以被外界访问，对外界提供服务；</li>
<li>我们能访问到的任何一个页面或者资源，都存在与这个世界的某一个角落的计算机上</li>
<li>URL</li>
<li>这个统一的 Web 资源会被放在同一个文件夹下，这就是一个 web 应用程序 —&gt; Tomcat服务器</li>
<li>一个 Web 应用由多部分组成<ul>
<li>html 、 css 、 js</li>
<li>jsp 、 servlet</li>
<li>java程序</li>
<li>jar包</li>
<li>配置文件（Properties）</li>
</ul>
</li>
</ul>
<p>web 应用程序编写完毕之后，若想提供给外界访问，需要一个服务器来统一管理</p>
<h3 id="1-3-静态-Web"><a href="#1-3-静态-Web" class="headerlink" title="1.3 静态 Web"></a>1.3 静态 Web</h3><ul>
<li><p><em>.htm、</em>.html ，这些都是网页的后缀，如果服务器上一直存在这些东西，我们就可以直接进行读取</p>
<p><img src="https://i.loli.net/2021/02/01/eksUPZfuXMdVaxY.png" srcset="/img/loading.gif" lazyload alt="image-20210201151842947"></p>
</li>
<li><p>静态 web 存在的缺点：</p>
<ul>
<li>Web 页面无法动态更新，所有用户看到的都是同一个页面<ul>
<li>轮播图、点击特效（这是伪动态）</li>
<li>实现伪动态：JavaScript、VBScript</li>
</ul>
</li>
<li>它无法和数据库交互（数据无法持久化，用户无法交互）</li>
</ul>
</li>
</ul>
<h3 id="1-4-动态-Web"><a href="#1-4-动态-Web" class="headerlink" title="1.4 动态 Web"></a>1.4 动态 Web</h3><p>页面会动态展示：“Web的页面展示的效果因人而异”；</p>
<p><img src="https://i.loli.net/2021/02/01/ygZihtaJSdRD2CW.png" srcset="/img/loading.gif" lazyload alt="image-20210201152241521"></p>
<p>缺点</p>
<ul>
<li>假如服务器的动态 web 资源出现了错误，我们需要重新编写<strong>后台程序</strong>，重新发布：<ul>
<li>停机维护</li>
</ul>
</li>
</ul>
<p>优点：</p>
<ul>
<li><p>Web页面可以动态更新，所有用户看到都不是同一个页面</p>
</li>
<li><p>它可以与数据库交互 （数据持久化：注册，商品信息，用户信息……..）</p>
<p><img src="https://i.loli.net/2021/02/01/Exhn7kOTpYQ3H8G.png" srcset="/img/loading.gif" lazyload alt="image-20210201152710944"></p>
</li>
</ul>
<h2 id="2、Web-服务器"><a href="#2、Web-服务器" class="headerlink" title="2、Web 服务器"></a>2、Web 服务器</h2><h3 id="2-1-技术讲解"><a href="#2-1-技术讲解" class="headerlink" title="2.1 技术讲解"></a>2.1 技术讲解</h3><p><strong>ASP：</strong></p>
<ul>
<li>微软：国内最早流行的就是 ASP；</li>
<li>在 HTML 中嵌入了 VB 的脚本，ASP + COM；</li>
<li>在 ASP 开发中，基本一个页面都有几千行代码，页面及其混乱，维护成本高</li>
<li>主要使用 C#</li>
</ul>
<p><strong>PHP：</strong></p>
<ul>
<li>PHP 开服速度很快，功能很强大，跨平台，代码简单</li>
<li>无法承载大访问量的情况，有局限性</li>
</ul>
<p><strong>JSP/Servlet:</strong></p>
<ul>
<li><p>是 sun 公司主推 B/S（浏览器和服务器） 架构</p>
</li>
<li><p>基于 Java 语言的</p>
</li>
<li><p>可以承载高并发、高可用、高性能带来的影响</p>
</li>
<li><p>语法像 ASP，加强市场的竞争力度</p>
</li>
</ul>
<h3 id="2-2-web服务器"><a href="#2-2-web服务器" class="headerlink" title="2.2 web服务器"></a>2.2 web服务器</h3><p>服务器是一种被动的操作，用来处理一些用户的请求和给用户的一些相应信息</p>
<p><strong>IIS：</strong> 微软的，windows 中自带的</p>
<p><strong>Tomcat：</strong> </p>
<p><img src="https://i.loli.net/2021/02/01/eMNZKPVuC8avJhY.png" srcset="/img/loading.gif" lazyload alt="image-20210201155032470"></p>
<p>Tomcat是Apache 软件基金会（Apache Software Foundation）的Jakarta 项目中的一个核心项目，最新的Servlet 和JSP 规范总是能在Tomcat 中得到体现，因为Tomcat 技术先进、性能稳定，而且<strong>免费</strong>，因而深受Java 爱好者的喜爱并得到了部分软件开发商的认可，成为目前比较流行的Web 应用服务器。</p>
<p>Tomcat 服务器是一个免费的开放源代码的Web 应用服务器，属于轻量级应用服务器，<strong>在中小型系统和并发访问用户不是很多的场合下被普遍使用</strong>，是开发和调试JSP 程序的首选。对于一个初学Javaweb的人来说，它是最佳的选择</p>
<p>Tomcat 实际上运行JSP 页面和Servlet。Tomcat最新版本为<strong>9.0.41</strong>（2021/02/01）</p>
<p>……</p>
<p>下载 Tomcat：</p>
<ol>
<li>安装 或 解压</li>
<li>了解配置文件及目录结构</li>
<li>作用</li>
</ol>
<h2 id="3、Tomcat"><a href="#3、Tomcat" class="headerlink" title="3、Tomcat"></a>3、Tomcat</h2><h3 id="3-1-安装-Tomcat"><a href="#3-1-安装-Tomcat" class="headerlink" title="3.1 安装 Tomcat"></a>3.1 安装 Tomcat</h3><p><a target="_blank" rel="noopener" href="https://tomcat.apache.org/">tomcat官网</a></p>
<p><img src="https://i.loli.net/2021/02/01/8oPOlrnHvjmVsUL.png" srcset="/img/loading.gif" lazyload alt="image-20210201160415776"></p>
<h3 id="3-2-Tomcat-启动和配置"><a href="#3-2-Tomcat-启动和配置" class="headerlink" title="3.2 Tomcat 启动和配置"></a>3.2 Tomcat 启动和配置</h3><p><strong>文件夹信息</strong></p>
<p><img src="https://i.loli.net/2021/02/01/wbz7PUYAts1QrW9.png" srcset="/img/loading.gif" lazyload alt="image-20210201161241671"></p>
<p><strong>启动 、关闭 Tomcat</strong></p>
<p><img src="https://i.loli.net/2021/02/01/2iHx1hGyLugEptQ.png" srcset="/img/loading.gif" lazyload alt="image-20210201161649752"></p>
<p><strong>访问测试</strong>：<a target="_blank" rel="noopener" href="http://localhost:8080/">http://localhost:8080</a></p>
<p>可能遇到的问题：</p>
<ol>
<li><p>Java 环境变量没有配置</p>
</li>
<li><p>闪退问题：需要配置兼容性</p>
</li>
<li><p>乱码问题：配置文件中设置（修改 conf /logging.properties 中的 java.util.logging.ConsoleHandler.encoding，将其值修改为 GBK）（其实也没太重要，只是显示有问题）</p>
<p>原图：</p>
<p><img src="https://i.loli.net/2021/02/01/emoNubGdwvR2MJW.png" srcset="/img/loading.gif" lazyload alt="image-20210201162559283"></p>
<p>修改后：</p>
<p><img src="https://i.loli.net/2021/02/01/sqIrKRm4gBZM7cL.png" srcset="/img/loading.gif" lazyload alt="image-20210201162634240"></p>
</li>
</ol>
<h3 id="3-3-配置"><a href="#3-3-配置" class="headerlink" title="3.3 配置"></a>3.3 配置</h3><p><img src="https://i.loli.net/2021/02/01/GMTDKYvSIbe1k3Z.png" srcset="/img/loading.gif" lazyload alt="image-20210201162947752"></p>
<p><strong>可以配置启动的端口号</strong></p>
<ul>
<li>tomcat默认端口号为：8080</li>
<li>mysql：3306</li>
<li>http：80</li>
<li>https：443</li>
</ul>
<p><img src="https://i.loli.net/2021/02/01/tqfE8KG4PjMY9pe.png" srcset="/img/loading.gif" lazyload alt="image-20210201164300693"></p>
<p><strong>可以配置主机的名称</strong></p>
<ul>
<li>默认的主机名称为：localhost —&gt; 对应IP:127.0.0.1</li>
<li>默认的网站应用存放的位置为：webapps</li>
</ul>
<p><img src="https://i.loli.net/2021/02/01/MY8nxGrWdbVZBOv.png" srcset="/img/loading.gif" lazyload alt="image-20210201165115952"></p>
<h4 id="高难度面试题："><a href="#高难度面试题：" class="headerlink" title="高难度面试题："></a>高难度面试题：</h4><p><strong>请你谈一谈网站是如何进行访问的？</strong></p>
<ol>
<li><p>输入一个域名，点击回车</p>
</li>
<li><p>先检查本机的 C:\Windows\System32\drivers\etc\hosts 配置文件中有没有这个域名的映射</p>
<ol>
<li><p>有，直接返回对应的 ip 地址</p>
<p><img src="https://i.loli.net/2021/02/01/9RCJEz87fGxYm42.png" srcset="/img/loading.gif" lazyload alt="image-20210201170039775"></p>
</li>
<li><p>没有，去 DNS 服务器找，找到的话就返回，找不到就返回找不到</p>
</li>
</ol>
<p><img src="https://i.loli.net/2021/02/01/sXn7aH2ktRiVlN5.png" srcset="/img/loading.gif" lazyload alt="image-20210201170712282"></p>
</li>
</ol>
<h3 id="3-4-发布一个-web-网站"><a href="#3-4-发布一个-web-网站" class="headerlink" title="3.4 发布一个 web 网站"></a>3.4 发布一个 web 网站</h3><p>不会就先模仿</p>
<ul>
<li>将自己写的网站，放到服务器（Tomcat）中指定的 web 应用文件夹（webapps）下，就可以访问了</li>
</ul>
<p>网站应该有的结构：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><code class="hljs java">--webapps ： Tomcat服务器的 web 目录<br>    -ROOT<br>    -yechen-ops ： 网站的目录名<br>    	-WEB-INF<br>    		-Classes ： java程序<br>    		-lib ： web 应用所依赖的 jar 包<br>    		-web.xml ： 网站的配置文件<br>    	-index.html ： 默认的首页<br>    	-<span class="hljs-keyword">static</span> ： 静态资源文件<br>    		-css<br>    		-js<br>    		-img<br>    	......<br></code></pre></td></tr></table></figure>



<h2 id="4、HTTP（还不大懂）"><a href="#4、HTTP（还不大懂）" class="headerlink" title="4、HTTP（还不大懂）"></a>4、HTTP（还不大懂）</h2><h3 id="4-1-什么是-HTTP"><a href="#4-1-什么是-HTTP" class="headerlink" title="4.1 什么是 HTTP"></a>4.1 什么是 HTTP</h3><p>HTTP（超文本传输协议）是一个简单的 请求 - 相应 协议，它通常运行在 TCP 之上</p>
<ul>
<li>文本：html，字符串, ……</li>
<li>超文本：图片、音乐、视频、定位、地图……</li>
<li>默认端口：80</li>
</ul>
<p>Https：安全的</p>
<ul>
<li>默认端口：443</li>
</ul>
<h3 id="4-2-两个时代"><a href="#4-2-两个时代" class="headerlink" title="4.2 两个时代"></a>4.2 两个时代</h3><ul>
<li><strong>http1.0</strong><ul>
<li>HTTP/1.0：客户端可以与 web服务端连接后，只能获得一个 web 资源</li>
</ul>
</li>
<li><strong>http2.0</strong><ul>
<li>HTTP/1.1：客户端可以与 web服务端连接后，可以获得多个 web 资源</li>
</ul>
</li>
</ul>
<h3 id="4-3-HTTP-请求"><a href="#4-3-HTTP-请求" class="headerlink" title="4.3 HTTP 请求"></a>4.3 HTTP 请求</h3><ul>
<li>客户端 —&gt; 发请求（Request） —&gt; 服务器</li>
</ul>
<p>以百度为例：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs java">Request URL:https:<span class="hljs-comment">//www.baidu.com/ 请求地址 </span><br>Request Method:GET 			get方法/post方法 <br>Status Code:<span class="hljs-number">200</span> OK 			状态码：<span class="hljs-number">200</span> <br>Remote（远程） Address:<span class="hljs-number">14.215</span><span class="hljs-number">.177</span><span class="hljs-number">.39</span>:<span class="hljs-number">443</span>	远程地址<br></code></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs java">Accept:text/html <br>Accept-Encoding:gzip, deflate, br <br>Accept-Language:zh-CN,zh;q=<span class="hljs-number">0.9</span> 语言 <br>Cache-Control:max-age=<span class="hljs-number">0</span> <br>Connection:keep-alive<br></code></pre></td></tr></table></figure>

<h4 id="4-3-1-请求行"><a href="#4-3-1-请求行" class="headerlink" title="4.3.1 请求行"></a>4.3.1 请求行</h4><ul>
<li>请求行中的请求方式：GET</li>
<li>请求方式： <strong>Get</strong> 、 <strong>Post</strong><ul>
<li>Get：请求能够携带的参数比较小，大小有限制，会在浏览器的 URL 地址栏上显示数据内容，不安全，但高效</li>
<li>Post：请求能够携带的参数无限制，大小无限制，不会在浏览器的 URL 地址栏上显示数据内容，安全，但不高效</li>
</ul>
</li>
</ul>
<h4 id="4-3-2-请求行"><a href="#4-3-2-请求行" class="headerlink" title="4.3.2 请求行"></a>4.3.2 请求行</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><code class="hljs java">Accept：告诉浏览器，它支持的数据类型<br>Accept-Encoding：支持那种编码格式 <br>Accept-Language：告诉浏览器，它的语言环境 <br>Cache-Control：缓存控制<br>Connection：告诉浏览器，请求是断开还是保持连接<br>HOST：主机<br>......<br></code></pre></td></tr></table></figure>



<h3 id="4-4-HTTP相应"><a href="#4-4-HTTP相应" class="headerlink" title="4.4 HTTP相应"></a>4.4 HTTP相应</h3><ul>
<li>服务器 —&gt; 相应 —&gt; 客户端</li>
</ul>
<p>以百度为例：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs java">Cache-Control: <span class="hljs-keyword">private</span>			缓存控制<br>Connection: keep-alive			连接<br>Content-Encoding: gzip			编码<br>Content-Type: text/html;		类型<br></code></pre></td></tr></table></figure>

<h4 id="4-4-1-相应体"><a href="#4-4-1-相应体" class="headerlink" title="4.4.1 相应体"></a>4.4.1 相应体</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><code class="hljs java">Accept：告诉浏览器，它支持的数据类型<br>Accept-Encoding：支持那种编码格式 <br>Accept-Language：告诉浏览器，它的语言环境 <br>Cache-Control：缓存控制<br>Connection：告诉浏览器，请求是断开还是保持连接<br>HOST：主机<br>Refresh：告诉客户端，多久刷新一次<br>Localhost：让网页重新定位<br></code></pre></td></tr></table></figure>

<h4 id="4-4-2-相应状态码（重点）"><a href="#4-4-2-相应状态码（重点）" class="headerlink" title="4.4.2 相应状态码（重点）"></a>4.4.2 相应状态码（重点）</h4><p>2XX：请求相应成功（200）</p>
<p>3XX：请求重定向</p>
<ul>
<li>重定向：你重新到我给你的新位置去</li>
</ul>
<p>4XX：找不到资源（404）</p>
<p>5XX：服务器代码错误（500）（502 网关错误）</p>
<p><strong>常见面试题：</strong></p>
<p>当你的浏览器地址栏中输入地址并回车的一瞬间到页面能够展示回来，经历了什么？</p>
<p><a target="_blank" rel="noopener" href="https://www.zhihu.com/question/34873227">找的一个回答</a></p>
<h2 id="5、Maven"><a href="#5、Maven" class="headerlink" title="5、Maven"></a>5、Maven</h2><p><strong>我为什么要学习这个技术</strong></p>
<ol>
<li>在 JavaWeb 开发中，需要使用大量的 jar 包，我们需要手动去导入</li>
<li>如何能够让一个东西自动帮我们导入和配置这个 jar 包</li>
</ol>
<p>由此 Maven 诞生了</p>
<h3 id="5-1-Maven项目架构管理工具"><a href="#5-1-Maven项目架构管理工具" class="headerlink" title="5.1 Maven项目架构管理工具"></a>5.1 Maven项目架构管理工具</h3><p>我们目前就就是用来方便导入 jar 包的</p>
<p>Maven的核心思想：<strong>约定大于配置</strong></p>
<ul>
<li>有约束，不要去违反</li>
</ul>
<p>Maven会规定好你该如何去编写我们的 Java 代码，必须要按照这个规范来</p>
<h3 id="5-2-下载安装-Maven"><a href="#5-2-下载安装-Maven" class="headerlink" title="5.2 下载安装 Maven"></a>5.2 下载安装 Maven</h3><p><a target="_blank" rel="noopener" href="https://maven.apache.org/">Maven官网</a></p>
<p><img src="https://i.loli.net/2021/02/01/ZqSmxKpRQ8UHaod.png" srcset="/img/loading.gif" lazyload alt="image-20210201204538495"></p>
<h3 id="5-3-配置环境变量"><a href="#5-3-配置环境变量" class="headerlink" title="5.3 配置环境变量"></a>5.3 配置环境变量</h3><p>配置如下：</p>
<ul>
<li>M2_HOME：maven目录下的 bin 目录</li>
<li>MAVEN_HOME：maven的目录</li>
<li>在系统的 path 中配置 %MAVEN_HOME%\bin</li>
</ul>
<p>确保配置成功</p>
<p><img src="https://i.loli.net/2021/02/01/rfiYc8XJzEPuk1A.png" srcset="/img/loading.gif" lazyload alt="image-20210201212204477"></p>
<h3 id="5-4-阿里云镜像"><a href="#5-4-阿里云镜像" class="headerlink" title="5.4 阿里云镜像"></a>5.4 阿里云镜像</h3><ul>
<li>镜像（mirrors）：<ul>
<li>作用：加速我们的下载速度</li>
</ul>
</li>
<li>国内建议使用阿里云的镜像，在 <strong>conf/setting.xml</strong> 文件下的 **mirrors **标签下配置</li>
</ul>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">mirror</span>&gt;</span><br>		<span class="hljs-tag">&lt;<span class="hljs-name">id</span>&gt;</span>aliyunmaven<span class="hljs-tag">&lt;/<span class="hljs-name">id</span>&gt;</span><br>		<span class="hljs-tag">&lt;<span class="hljs-name">mirrorOf</span>&gt;</span>central<span class="hljs-tag">&lt;/<span class="hljs-name">mirrorOf</span>&gt;</span><br>		<span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>aliyun maven<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span><br>		<span class="hljs-tag">&lt;<span class="hljs-name">url</span>&gt;</span>https://maven.aliyun.com/repository/public <span class="hljs-tag">&lt;/<span class="hljs-name">url</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">mirror</span>&gt;</span><br>或者是（其实都一样）<br><span class="hljs-tag">&lt;<span class="hljs-name">mirror</span>&gt;</span> <br>    <span class="hljs-tag">&lt;<span class="hljs-name">id</span>&gt;</span>nexus-aliyun<span class="hljs-tag">&lt;/<span class="hljs-name">id</span>&gt;</span> <br>    <span class="hljs-tag">&lt;<span class="hljs-name">mirrorOf</span>&gt;</span>*,!jeecg,!jeecg-snapshots<span class="hljs-tag">&lt;/<span class="hljs-name">mirrorOf</span>&gt;</span> <br>    <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>Nexus aliyun<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span> <br>    <span class="hljs-tag">&lt;<span class="hljs-name">url</span>&gt;</span>http://maven.aliyun.com/nexus/content/groups/public<span class="hljs-tag">&lt;/<span class="hljs-name">url</span>&gt;</span> <br><span class="hljs-tag">&lt;/<span class="hljs-name">mirror</span>&gt;</span><br></code></pre></td></tr></table></figure>

<h3 id="5-5-本地仓库"><a href="#5-5-本地仓库" class="headerlink" title="5.5 本地仓库"></a>5.5 本地仓库</h3><p><strong>建立一个本地仓库</strong>（LocalRepository）</p>
<p><img src="https://i.loli.net/2021/02/01/2xLRIT7Bia4smMX.png" srcset="/img/loading.gif" lazyload alt="image-20210201213820943"></p>
<p>在 <strong>conf/setting.xml</strong> 文件下配置</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">localRepository</span>&gt;</span>D:\Environmental\Maven\apache-maven-3.6.3\maven-repo<span class="hljs-tag">&lt;/<span class="hljs-name">localRepository</span>&gt;</span><br></code></pre></td></tr></table></figure>

<h3 id="5-6-在IDEA中使用-Maven"><a href="#5-6-在IDEA中使用-Maven" class="headerlink" title="5.6 在IDEA中使用 Maven"></a>5.6 在IDEA中使用 Maven</h3><ol>
<li><p>启动 IDEA</p>
</li>
<li><p>创建一个 MavenWeb（使用模板的） 项目</p>
<p><img src="https://i.loli.net/2021/02/01/VTo4xOESeiwUuNL.png" srcset="/img/loading.gif" lazyload alt="image-20210201214810205"></p>
<p><img src="https://i.loli.net/2021/02/01/RGDgMYQBr4VouXE.png" srcset="/img/loading.gif" lazyload alt="image-20210201215025855"></p>
</li>
</ol>
<p><img src="https://i.loli.net/2021/02/01/Thk1Kv8LHOYn9dr.png" srcset="/img/loading.gif" lazyload alt="image-20210201215634720"></p>
<p><img src="https://i.loli.net/2021/02/01/pU5dXJsaKCQFjTV.png" srcset="/img/loading.gif" lazyload alt="image-20210201215854686"></p>
<p>最后设置完点 finish</p>
<p><img src="https://i.loli.net/2021/02/01/VGHRqLf1ID8ZWlE.png" srcset="/img/loading.gif" lazyload alt="image-20210201220028700"></p>
<ol start="3">
<li><p>等待项目构建成功</p>
<p><img src="https://i.loli.net/2021/02/01/3bcaLPsJtNhMGde.png" srcset="/img/loading.gif" lazyload alt="image-20210201220512686"></p>
</li>
<li><p>观察 Maven仓库中多了那些东西</p>
</li>
<li><p>IDEA中的 Maven 设置</p>
<p><strong>注意：IDEA项目创建成功之后，看一眼 Maven 的配置</strong></p>
<p><img src="https://i.loli.net/2021/02/01/xozmckFMIfnuGR6.png" srcset="/img/loading.gif" lazyload alt="image-20210201221514502"></p>
</li>
</ol>
<p><img src="https://i.loli.net/2021/02/01/246tMWUFkYBimbC.png" srcset="/img/loading.gif" lazyload alt="image-20210201221836454"></p>
<ol start="6">
<li>到这里，Maven 在 IDEA 中的配置就基本 OK 了！</li>
</ol>
<h3 id="5-7-创建一个普通的-Maven-项目（不勾模板）"><a href="#5-7-创建一个普通的-Maven-项目（不勾模板）" class="headerlink" title="5.7 创建一个普通的 Maven 项目（不勾模板）"></a>5.7 创建一个普通的 Maven 项目（不勾模板）</h3><p><img src="https://i.loli.net/2021/02/01/FfMi48Zsmaur1xL.png" srcset="/img/loading.gif" lazyload alt="image-20210201222451893"></p>
<p><strong>这是干净的 Maven 项目</strong></p>
<p><img src="https://i.loli.net/2021/02/01/7yYhXMZpEJUQb42.png" srcset="/img/loading.gif" lazyload alt="image-20210201225642870"></p>
<p>这个只有在 Web 应用下才会有！</p>
<p><img src="https://i.loli.net/2021/02/01/x7e623hbl9pw8uX.png" srcset="/img/loading.gif" lazyload alt="image-20210201225857449"></p>
<h3 id="5-8-标记文件夹功能"><a href="#5-8-标记文件夹功能" class="headerlink" title="5.8 标记文件夹功能"></a>5.8 标记文件夹功能</h3><p><strong>第一种</strong></p>
<p><img src="https://img-blog.csdnimg.cn/20210201232103845.png" srcset="/img/loading.gif" lazyload alt="20210201232103845.png"></p>
<p><img src="https://img-blog.csdnimg.cn/20210201232103900.png" srcset="/img/loading.gif" lazyload alt="20210201232103900.png"></p>
<p>第二种</p>
<p><img src="https://img-blog.csdnimg.cn/20210201232407953.png" srcset="/img/loading.gif" lazyload alt="20210201232407953.png"></p>
<p><img src="https://img-blog.csdnimg.cn/20210201232821875.png" srcset="/img/loading.gif" lazyload alt="20210201232821875.png"></p>
<h3 id="5-9-在-IDEA-中配置-Tomcat及其使用"><a href="#5-9-在-IDEA-中配置-Tomcat及其使用" class="headerlink" title="5.9 在 IDEA 中配置 Tomcat及其使用"></a>5.9 在 IDEA 中配置 Tomcat及其使用</h3><p><img src="https://img-blog.csdnimg.cn/20210201233434161.png" srcset="/img/loading.gif" lazyload alt="20210201233434161.png"></p>
<p><img src="https://img-blog.csdnimg.cn/20210202115926252.png" srcset="/img/loading.gif" lazyload alt="20210202115926252.png"></p>
<p><img src="https://img-blog.csdnimg.cn/20210201235351393.png" srcset="/img/loading.gif" lazyload alt="20210201235351393.png"></p>
<p>解决警告问题：</p>
<ul>
<li>为什么会有这个问题：我们访问一个网站，需要指定一个文件夹的名字</li>
</ul>
<p><img src="https://img-blog.csdnimg.cn/20210202120053873.png" srcset="/img/loading.gif" lazyload alt="20210202120053873.png"></p>
<p><img src="https://img-blog.csdnimg.cn/20210202120142793.png" srcset="/img/loading.gif" lazyload alt="20210202120142793.png"></p>
<p><img src="https://img-blog.csdnimg.cn/20210202000907983.png" srcset="/img/loading.gif" lazyload alt="20210202000907983.png"></p>
<p>​    </p>
<p><img src="https://img-blog.csdnimg.cn/20210202120229123.png" srcset="/img/loading.gif" lazyload alt="20210202120229123.png"></p>
<h3 id="5-10-pom文件"><a href="#5-10-pom文件" class="headerlink" title="5.10 pom文件"></a>5.10 pom文件</h3><p>pom.xml 是Maven的核心配置文件</p>
<p><img src="https://img-blog.csdnimg.cn/20210202120306118.png" srcset="/img/loading.gif" lazyload alt="image-20210202114913988"></p>
<p><strong>这是使用 Maven 模板生成的项目的 pom.xml 文件</strong></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-meta">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span><br><br><span class="hljs-comment">&lt;!--Maven版本和头文件--&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">project</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">&quot;http://maven.apache.org/POM/4.0.0&quot;</span> <span class="hljs-attr">xmlns:xsi</span>=<span class="hljs-string">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span><br><span class="hljs-tag">  <span class="hljs-attr">xsi:schemaLocation</span>=<span class="hljs-string">&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;</span>&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">modelVersion</span>&gt;</span>4.0.0<span class="hljs-tag">&lt;/<span class="hljs-name">modelVersion</span>&gt;</span><br><br>  <span class="hljs-comment">&lt;!--这里就是我们刚才配置的 GAV--&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>com.yechen-ops<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>javaweb-01-maven<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>1.0-SNAPSHOT<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br>  <span class="hljs-comment">&lt;!--</span><br><span class="hljs-comment">    项目的打包方式：</span><br><span class="hljs-comment">    jar：Java 应用</span><br><span class="hljs-comment">    wer：JavaWeb 应用</span><br><span class="hljs-comment">  --&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">packaging</span>&gt;</span>war<span class="hljs-tag">&lt;/<span class="hljs-name">packaging</span>&gt;</span><br><br>  <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>javaweb-01-maven Maven Webapp<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span><br>  <span class="hljs-comment">&lt;!-- FIXME change it to the project&#x27;s website --&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">url</span>&gt;</span>http://www.example.com<span class="hljs-tag">&lt;/<span class="hljs-name">url</span>&gt;</span><br><br>  <span class="hljs-comment">&lt;!--配置--&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">properties</span>&gt;</span><br>    <span class="hljs-comment">&lt;!--项目的默认构建编码--&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">project.build.sourceEncoding</span>&gt;</span>UTF-8<span class="hljs-tag">&lt;/<span class="hljs-name">project.build.sourceEncoding</span>&gt;</span><br>    <span class="hljs-comment">&lt;!--编码版本--&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">maven.compiler.source</span>&gt;</span>1.7<span class="hljs-tag">&lt;/<span class="hljs-name">maven.compiler.source</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">maven.compiler.target</span>&gt;</span>1.7<span class="hljs-tag">&lt;/<span class="hljs-name">maven.compiler.target</span>&gt;</span><br>  <span class="hljs-tag">&lt;/<span class="hljs-name">properties</span>&gt;</span><br><br>  <span class="hljs-comment">&lt;!--依赖--&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">dependencies</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span><br>      <span class="hljs-comment">&lt;!--具体的jar包配置文件--&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>junit<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>junit<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>4.11<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">scope</span>&gt;</span>test<span class="hljs-tag">&lt;/<span class="hljs-name">scope</span>&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span><br>  <span class="hljs-tag">&lt;/<span class="hljs-name">dependencies</span>&gt;</span><br><br>  <span class="hljs-comment">&lt;!--项目构建的用的东西--&gt;</span><br>  <span class="hljs-tag">&lt;<span class="hljs-name">build</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">finalName</span>&gt;</span> javaweb-01-maven<span class="hljs-tag">&lt;/<span class="hljs-name">finalName</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">pluginManagement</span>&gt;</span><span class="hljs-comment">&lt;!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">plugins</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>maven-clean-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>3.1.0<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span><br>        <span class="hljs-comment">&lt;!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>maven-resources-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>3.0.2<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>maven-compiler-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>3.8.0<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>maven-surefire-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.22.1<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>maven-war-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>3.2.2<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>maven-install-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.5.2<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">plugin</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>maven-deploy-plugin<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>          <span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>2.8.2<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">plugin</span>&gt;</span><br>      <span class="hljs-tag">&lt;/<span class="hljs-name">plugins</span>&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-name">pluginManagement</span>&gt;</span><br>  <span class="hljs-tag">&lt;/<span class="hljs-name">build</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">project</span>&gt;</span><br><br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/20210202144510712.png" srcset="/img/loading.gif" lazyload alt="image-20210202144445974"></p>
<p><strong>由于 Maven 的约定大于配置，所以我们之后可能遇到我们写的配置文件（比如在 java 目录下添加了资源文件），无法被导出或者生效问题，解决方案：</strong></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-comment">&lt;!-- 在build中配置Resources, 来防止我们资源导出失败的问题 --&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">build</span>&gt;</span><br>	<span class="hljs-tag">&lt;<span class="hljs-name">resources</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">resource</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">directory</span>&gt;</span>src/main/java<span class="hljs-tag">&lt;/<span class="hljs-name">directory</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">includes</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-name">include</span>&gt;</span>**/*.properties<span class="hljs-tag">&lt;/<span class="hljs-name">include</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-name">include</span>&gt;</span>**/*.xml<span class="hljs-tag">&lt;/<span class="hljs-name">include</span>&gt;</span><br>            <span class="hljs-tag">&lt;/<span class="hljs-name">includes</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">filtering</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-name">filtering</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">resource</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-name">resource</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">directory</span>&gt;</span>src/main/resources<span class="hljs-tag">&lt;/<span class="hljs-name">directory</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">includes</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-name">include</span>&gt;</span>**/*.properties<span class="hljs-tag">&lt;/<span class="hljs-name">include</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-name">include</span>&gt;</span>**/*.xml<span class="hljs-tag">&lt;/<span class="hljs-name">include</span>&gt;</span><br>            <span class="hljs-tag">&lt;/<span class="hljs-name">includes</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-name">filtering</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-name">filtering</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-name">resource</span>&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-name">resources</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">build</span>&gt;</span><br></code></pre></td></tr></table></figure>



<h3 id="5-11-IDEA的骚操作（查看依赖jar包关系图）"><a href="#5-11-IDEA的骚操作（查看依赖jar包关系图）" class="headerlink" title="5.11 IDEA的骚操作（查看依赖jar包关系图）"></a>5.11 IDEA的骚操作（查看依赖jar包关系图）</h3><p><img src="https://img-blog.csdnimg.cn/20210202145820296.png" srcset="/img/loading.gif" lazyload alt="image-20210202145756356"></p>
<h3 id="5-13-解决遇到的问题"><a href="#5-13-解决遇到的问题" class="headerlink" title="5.13 解决遇到的问题"></a>5.13 解决遇到的问题</h3><ol>
<li><p>Maven 3.6.2创建创建项目报错</p>
<p><img src="https://img-blog.csdnimg.cn/20210202151746177.png" srcset="/img/loading.gif" lazyload alt="image-20210202151731674"></p>
<ul>
<li>解决方法：降级</li>
</ul>
</li>
<li><p>Tomcat闪退</p>
<ul>
<li>解决方法：正确配置 java 环境</li>
</ul>
</li>
<li><p>IDEA中每次都要重复配置Maven</p>
<ul>
<li><p>解决方法：在 IDEA 的全局默认配置中去配置</p>
<p><img src="https://img-blog.csdnimg.cn/20210202152256647.png" srcset="/img/loading.gif" lazyload alt="image-20210202152241116"></p>
<p><img src="https://img-blog.csdnimg.cn/20210202152522229.png" srcset="/img/loading.gif" lazyload alt="image-20210202152510049"></p>
</li>
</ul>
</li>
<li><p> Maven项目中Tomcat无法配置</p>
</li>
<li><p> maven默认web项目中的web.xml版本问题</p>
</li>
</ol>
<p>   <img src="https://img-blog.csdnimg.cn/20210202153301568.png" srcset="/img/loading.gif" lazyload alt="image-20210202153248883"></p>
<ul>
<li>替换 web.xml 版本和 tomcat 一致</li>
</ul>
   <figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-meta">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span><br><br><span class="hljs-tag">&lt;<span class="hljs-name">web-app</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">&quot;http://xmlns.jcp.org/xml/ns/javaee&quot;</span></span><br><span class="hljs-tag">  <span class="hljs-attr">xmlns:xsi</span>=<span class="hljs-string">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span><br><span class="hljs-tag">  <span class="hljs-attr">xsi:schemaLocation</span>=<span class="hljs-string">&quot;http://xmlns.jcp.org/xml/ns/javaee</span></span><br><span class="hljs-string"><span class="hljs-tag">                      http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd&quot;</span></span><br><span class="hljs-tag">  <span class="hljs-attr">version</span>=<span class="hljs-string">&quot;4.0&quot;</span></span><br><span class="hljs-tag">  <span class="hljs-attr">metadata-complete</span>=<span class="hljs-string">&quot;true&quot;</span>&gt;</span><br><br><span class="hljs-tag">&lt;/<span class="hljs-name">web-app</span>&gt;</span><br><br></code></pre></td></tr></table></figure>

<ol start="6">
<li><p>Maven仓库的使用</p>
<p><a target="_blank" rel="noopener" href="https://mvnrepository.com/">Maven仓库</a></p>
<p><img src="https://img-blog.csdnimg.cn/20210202154742297.png" srcset="/img/loading.gif" lazyload alt="image-20210202154725819"></p>
</li>
</ol>
<p><img src="https://img-blog.csdnimg.cn/20210202154936922.png" srcset="/img/loading.gif" lazyload alt="image-20210202154901458"></p>
<p><img src="https://img-blog.csdnimg.cn/20210202163245149.png" srcset="/img/loading.gif" lazyload alt="image-20210202163231928"></p>
<h2 id="6、Servlet"><a href="#6、Servlet" class="headerlink" title="6、Servlet"></a>6、Servlet</h2><p><strong>Servlet 接口 Sun 公司有两个默认的实现类：==HttpServlet== 和 ==GenericServlet==</strong></p>
<h3 id="6-1-Servlet"><a href="#6-1-Servlet" class="headerlink" title="6.1 Servlet"></a>6.1 Servlet</h3><ul>
<li>Servlet 就是 sun 公司开发 <strong>动态 web</strong> 的一门技术</li>
<li>Sun 公司在 API 中提供了一个接口叫做：Servlet，如果你想开发一个 Servlet 程序，只需要完成两个小步骤：<ul>
<li>编写一个类实现 Servlet 接口</li>
<li>把开发好的 Java 类部署到服务器中</li>
</ul>
</li>
</ul>
<p><strong>把实现了 Servlet 接口的程序叫做：Servlet</strong></p>
<h3 id="6-2-HelloServlet"><a href="#6-2-HelloServlet" class="headerlink" title="6.2 HelloServlet"></a>6.2 HelloServlet</h3><ol>
<li><p>构建一个普通的 Maven 项目，删掉里面的 src 目录，以后我们的学习就在这个项目里建立 Moudel</p>
</li>
<li><p>关于Maven 父子工程的理解：</p>
<ul>
<li><p>在父项目中的 pom.xml 中会出现</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">modules</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">module</span>&gt;</span>servlet01<span class="hljs-tag">&lt;/<span class="hljs-name">module</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">modules</span>&gt;</span><br></code></pre></td></tr></table></figure></li>
<li><p>在子项目中的 pom.xml 中会出现</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">parent</span>&gt;</span><br>	<span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>javaweb-02-servlet<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span><br>	<span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>cn.yechen-ops<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span><br>	<span class="hljs-tag">&lt;<span class="hljs-name">version</span>&gt;</span>1.0-SNAPSHOT<span class="hljs-tag">&lt;/<span class="hljs-name">version</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">parent</span>&gt;</span><br></code></pre></td></tr></table></figure></li>
<li><p>父项目中的 jar 包子项目可以直接使用</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs java">son extends father<br></code></pre></td></tr></table></figure></li>
</ul>
</li>
<li><p>Maven 环境优化</p>
<ol>
<li>[修改 web.xml 为最新的](###5.13 解决遇到的问题) 第 5 点</li>
<li>[将 Maven 的结构搭建完整](###5.8 标记文件夹功能)</li>
</ol>
</li>
<li><p>编写一个 Servlet 程序</p>
<ol>
<li>编写一个普通类</li>
<li>实现 Servlet 接口，我们就直接继承 HttpServlet 类</li>
</ol>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><code class="hljs java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">HelloServlet</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">HttpServlet</span> </span>&#123;<br><br>    <span class="hljs-comment">// 由于get或者post只是请求实现的不同方式，可以相互调用，业务逻辑都一样</span><br>    <span class="hljs-meta">@Override</span><br>    <span class="hljs-function"><span class="hljs-keyword">protected</span> <span class="hljs-keyword">void</span> <span class="hljs-title">doGet</span><span class="hljs-params">(HttpServletRequest req, HttpServletResponse resp)</span> <span class="hljs-keyword">throws</span> ServletException, IOException </span>&#123;<br>        <span class="hljs-comment">// ServletOutputStream outputStream = resp.getOutputStream();</span><br>        PrintWriter writer = resp.getWriter();<span class="hljs-comment">// 响应流</span><br>        writer.println(<span class="hljs-string">&quot;Hello,Servlet!&quot;</span>);<br>    &#125;<br><br>    <span class="hljs-meta">@Override</span><br>    <span class="hljs-function"><span class="hljs-keyword">protected</span> <span class="hljs-keyword">void</span> <span class="hljs-title">doPut</span><span class="hljs-params">(HttpServletRequest req, HttpServletResponse resp)</span> <span class="hljs-keyword">throws</span> ServletException, IOException </span>&#123;<br>        doGet(req, resp);<br>    &#125;<br>&#125;<br></code></pre></td></tr></table></figure></li>
<li><p>编写 Servlet 的映射</p>
<p>为什么要映射：我们写的是 Java 程序，但是要通过浏览器访问，而浏览器需要连接 web 服务器，所以我们需要在 web 服务中注册我们写的 servlet，还需要给他一个浏览器能够访问的路径。</p>
<p><strong>在 web.xml 中配置（这一步太重要了）</strong></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-comment">&lt;!--注册Servlet--&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">servlet</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">servlet-name</span>&gt;</span>hello<span class="hljs-tag">&lt;/<span class="hljs-name">servlet-name</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">servlet-class</span>&gt;</span>cn.yechen.servlet.HelloServlet<span class="hljs-tag">&lt;/<span class="hljs-name">servlet-class</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">servlet</span>&gt;</span><br><span class="hljs-comment">&lt;!--Servlet的请求路径--&gt;</span><br><span class="hljs-comment">&lt;!--一个Servlet对应一个Mapping（映射）--&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">servlet-mapping</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">servlet-name</span>&gt;</span>hello<span class="hljs-tag">&lt;/<span class="hljs-name">servlet-name</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">url-pattern</span>&gt;</span>/hello<span class="hljs-tag">&lt;/<span class="hljs-name">url-pattern</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">servlet-mapping</span>&gt;</span><br></code></pre></td></tr></table></figure></li>
<li><p>[配置 Tomcat](###5.9 在 IDEA 中配置 Tomcat及其使用)</p>
<ul>
<li><p>出现问题：没有Artifact</p>
<p><img src="https://img-blog.csdnimg.cn/20190223213215388.png" srcset="/img/loading.gif" lazyload></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/gbb123/p/6782227.html">解决方法</a></p>
</li>
</ul>
</li>
<li><p>启动测试</p>
<ul>
<li><p>出现问题：Tomcat 报 404 错误</p>
<ul>
<li>解决方法：<a target="_blank" rel="noopener" href="https://www.cnblogs.com/gbb123/p/6782227.html">链接</a>中的第二步    <a target="_blank" rel="noopener" href="https://blog.csdn.net/eaphyy/article/details/72513914">链接</a></li>
</ul>
<p><img src="https://img-blog.csdnimg.cn/20210202233327213.png" srcset="/img/loading.gif" lazyload alt="image-20210202233220297"></p>
</li>
</ul>
</li>
</ol>
<h3 id="6-3-Servlet-原理"><a href="#6-3-Servlet-原理" class="headerlink" title="6.3 Servlet 原理"></a>6.3 Servlet 原理</h3>
            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/JavaWeb/">JavaWeb</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/JavaWeb/">JavaWeb</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">
                  
                    本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！
                  
                </p>
              
              
                <div class="post-prevnext">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2021/09/13/JavaWeb-2021-09-13-Servlet-%E8%A7%84%E8%8C%83/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Servlet 规范</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2021/09/13/JavaWeb-2021-09-13-IDEA-%E5%8E%9F%E7%94%9F%E5%B8%B8%E7%94%A8%E5%BF%AB%E6%8D%B7%E9%94%AE/">
                        <span class="hidden-mobile">IDEA 原生常用快捷键</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
  </div>
  

  

  
</footer>


  <!-- SCRIPTS -->
  
  <script  src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" ></script>
<script  src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  
    <script  src="/js/img-lazyload.js" ></script>
  



  



  <script  src="https://cdn.jsdelivr.net/npm/tocbot@4.12.3/dist/tocbot.min.js" ></script>



  <script  src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js" ></script>



  <script  src="https://cdn.jsdelivr.net/npm/anchor-js@4.3.1/anchor.min.js" ></script>



  <script defer src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js" ></script>



  <script  src="/js/local-search.js" ></script>






  <script  src="https://cdn.jsdelivr.net/npm/typed.js@2.0.12/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
      typing(title)
      
    })(window, document);
  </script>














  
<script src="//cdn.jsdelivr.net/gh/bynotes/texiao/source/js/xiaoxuehua.js"></script>
<script src="//cdn.jsdelivr.net/gh/bynotes/texiao/source/js/caidai.js"></script>
<script src="//cdn.jsdelivr.net/gh/bynotes/texiao/source/js/love.js"></script>
<script src="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<script src="//cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script>



<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>

  <!--动态线条背景-->
  <script type="text/javascript" color="70,119,184" opacity='1' zIndex="-2" count="200" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js"></script>

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"model":{"jsonPath":"/live2dw/assets/koharu.model.json"},"display":{"position":"left","width":200,"height":400},"mobile":{"show":false},"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
